﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Xyz.BusinessObjects.Validation
{
    public class ValidateMandatory : ValidationRule
    {
        public ValidateMandatory(string propertyName)
            : base(propertyName)
        {
            ErrorMessage = string.Concat(propertyName, " is a mandatory field.");
        }

        public override bool Validate(object businessObject)
        {
            return GetPropertyValue(businessObject).ToString().Length > 0;
        }
    }
}
